﻿function $$(elemento) {
    return document.getElementById(elemento);
}

function Buscador(url) {
    document.location.href = url.replace("{0}", $$("Buscador").value);
}



///VALIDACION DE FORMULARIOS

function SoloNumeros(evt) {
    var nav4 = window.Event ? true : false;
    // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
    var key = nav4 ? evt.which : evt.keyCode;

    if (esIE8())
        key = evt.keyCode;

    return (key <= 13 || key == 44 || (key >= 48 && key <= 57));
}


function esInternetExplorer() {

    var explo = navigator.appName == "Microsoft Internet Explorer";
    return explo;
}

function esIE8() {

    if (esInternetExplorer()) {
        var useragent = navigator.appVersion;
        var version = useragent.split(';')[1];
        return version.indexOf("MSIE 8.0") == 1;
    }
    return false;
}

function esIE6() {

    if (esInternetExplorer()) {
        var useragent = navigator.appVersion;
        var version = useragent.split(';')[1];
        return version.indexOf("MSIE 6") == 1;
    }
    return false;
}

function esIE7() {

    if (esInternetExplorer()) {
        var useragent = navigator.appVersion;
        var version = useragent.split(';')[1];
        return version.indexOf("MSIE 7.0") == 1;
    }
    return false;
}

function SoloLetras(evt) {
    var nav4 = window.Event ? true : false;
    // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
    var key = nav4 ? evt.which : evt.keyCode;

    if (esIE8())
        key = evt.keyCode;

    return (key <= 13 || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || key == 32 || key == 225 || key == 233 || key == 237 || key == 243 || key == 250 || key == 241);
}

function FiltrarPorFecha() {
    document.location.href = "?ddlAnio_Inicio=" + $$("ddlAnio_Inicio").value + "&ddlMes_Inicio=" + $$("ddlMes_Inicio").value + "&ddlDia_Inicio=" + $$("ddlDia_Inicio").value + "&ddlAnio_Fin=" + $$("ddlAnio_Fin").value + "&ddlMes_Fin=" + $$("ddlMes_Fin").value + "&ddlDia_Fin=" + $$("ddlDia_Fin").value;
}